<?php
namespace app\topics\service;
/**
 * 系统菜单接口
 */
class TopicsService {

    /**
     * 获取菜单结构
     */
    public function getTypeTopics() {
        return [
            'common' => [
                'name' => '讨论',
                'sort' => 0,
                'label' => 'topicsDetail',
                'model' => 'topics/TopicsDetailCommon',
                'info_url' => 'topics/Detail/info',
                'list_url' => 'topics/Detail/index',
                'post_url' => 'topics/DetailCreate/index',

            ],
            'faq' => [
                'name' => '问答',
                'sort' => 1,
                'label' => 'topicsFaq',
                'model' => 'topics/TopicsDetailFaq',
                'info_url' => 'topics/Faq/info',
                'list_url' => 'topics/Faq/index',
                'post_url' => 'topics/FaqCreate/index',
            ]
        ];
    }

    /**
     * 获取所有类型
     */
    public function getTypeAll() {
        $data = array();
        $list = hook('service', 'topics', 'type');
        foreach ((array)$list as $value) {
            $data = array_merge_recursive((array)$data, (array)$value);
        }
        $data = array_sort($data, 'sort');
        return $data;
    }
}

